export function getStemmedPositions(metadata, field) {
    const positions = [];
    for (const match of Object.values(metadata)) {
        if (match[field]) {
            positions.push(...match[field].position);
        }
    }
    // Put positions with lower start pos before those with higher start pos.
    // Put longer positions before shorter positions when they are the same in start pos.
    return positions.sort((a, b) => a[0] - b[0] || b[1] - a[1]);
}
